# Dockerfile.debian php7.0
FROM debian:10.4

RUN sed -i "s@http://deb.debian.org@http://mirrors.aliyun.com@g" /etc/apt/sources.list && rm -Rf /var/lib/apt/lists/* && apt-get update

RUN apt-get -y install apt-transport-https lsb-release ca-certificates curl wget
RUN wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
RUN sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
RUN apt-get update
RUN apt-get install -y \
    tini \
    php7.0 \
    php7.0-dev \
    php7.0-common  \
    php7.0-apcu  \
    php7.0-bcmath  \
    php7.0-xmlwriter  \
    php7.0-ctype  \
    php7.0-curl  \
    php7.0-exif  \
    php7.0-iconv  \
    php7.0-intl  \
    php7.0-json  \
    php7.0-mbstring  \
    php7.0-opcache  \
    php7.0-mysqlnd  \
    php7.0-mysql  \
    php7.0-pgsql  \
    php7.0-phar  \
    php7.0-posix  \
    php7.0-xml  \
    php7.0-simplexml  \
    php7.0-mcrypt  \
    php7.0-xsl  \
    php7.0-zip  \
    php7.0-dom  \
    php7.0-redis  \
    php7.0-fpm  \
    php7.0-gd  \
    php7.0-tokenizer

# RUN ln -s /usr/bin/php7 /usr/bin/php
RUN sed -i -e "s#listen\s*=\s*/run/php/php7.0-fpm.sock#listen = 9000#g" /etc/php/7.0/fpm/pool.d/www.conf
RUN sed -i -e "s/; max_input_vars = 1000/max_input_vars = 2000/g" /etc/php/7.0/fpm/php.ini
RUN mkdir /run/php

ENTRYPOINT ["/usr/bin/tini", "--"]

CMD ["/usr/sbin/php-fpm7.0", "-R", "--nodaemonize"]

EXPOSE 9000

WORKDIR /home/xp/www